/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/

#pragma once

#include <memory>
#include <vector>
#include <db/db_interfaces.h>
#include <db/db_field_instance_t.h>
#include <db/db_tuple_definition.h>

namespace test_wrappers { namespace storage {

class tuple_instance :
    public std::enable_shared_from_this<tuple_instance>
{
public:
    // instantiation
    friend std::_Ref_count_obj<tuple_instance>;
    static std::shared_ptr<tuple_instance> create();
    static std::shared_ptr<tuple_instance> create(
        const std::vector<std::shared_ptr<field_instance>>& fieldInstances);

    // getters
    std::shared_ptr<field_instance> field(
        const field_id& fieldInstanceId
        ) const;

    std::shared_ptr<field_instance> fieldByUserFieldId(
        const field_id& userFieldId
        ) const;

    const std::vector<std::shared_ptr<field_instance>>& fieldInstances() const;

private:
    std::vector<std::shared_ptr<field_instance>> _fieldInstances;

    tuple_instance();
    tuple_instance(
        const std::vector<std::shared_ptr<field_instance>>& fieldInstances);
};



}} // test_wrappers::storage
